package com.action;

import com.pojo.Area;
import com.service.ProvinceService;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@CrossOrigin("*")
@RestController
public class ProvinceAction {

    @Autowired
    private ProvinceService provinceService;

    /**
     * 查询所有省份
     * @return
     */
    @RequestMapping("/findProvince")
    public ResponseBean findProvince(){
        List<Area> list = provinceService.findProvince();
        if (list != null){
            return new ResponseBean(200,0,list);
        }
        return new ResponseBean(500,0,"查询失败");
    }


}
